package cn.itsource.realm;

import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

public class MyCrmAuthenticationFilter extends FormAuthenticationFilter {
    @Override
    protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
        //对应options(预检)请求要放行
        HttpServletRequest req = (HttpServletRequest) request;
        String method = req.getMethod();
        if("OPTIONS".equalsIgnoreCase(method)){
            System.out.println("我来了老铁！！！！！！！！！！！！！！！！！！！！！！！！");
            return true;
        }
        return super.isAccessAllowed(request, response, mappedValue);
    }
}
